package cn.ht.bootdemo.designmode.facAndmethod.controller;

import cn.ht.bootdemo.common.anno.CheckUser;
import cn.ht.bootdemo.common.entity.ResultVo;
import cn.ht.bootdemo.common.utils.R;
import cn.ht.bootdemo.designmode.facAndmethod.factory.UserServiceStrategyFactory;
import cn.ht.bootdemo.designmode.facAndmethod.service.UserPayService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;

/**
 * @author ht
 * @Description:
 * @date 2020-5-13
 */
@RestController
@Validated
public class TestController {

    @GetMapping("test/{value}")
    @CheckUser
    public ResultVo testAnoo(@NotBlank String type,
                             @PathVariable("value") BigDecimal value){
        UserPayService service = UserServiceStrategyFactory.getByUserType(type);
        return R.success(service.quote(value));
    }
}
